package news.service;


import news.dao.ChartDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class ChartService {

    @Autowired
    private ChartDao chartDao;

    public Map<String,Object> barCharts() {
        HashMap<String, Object> map = new HashMap<>();
        //查询xdate
        List<String> list = chartDao.findtypeName();
        //查询ydate
        List<Integer> count = chartDao.countType();
        map.put("xdata",list);
        map.put("ydata",count);
        return map;
    }

    public List<Map<String, Integer>> pieCharts() {

        List<Map<String, Integer>> res = chartDao.find();
        return res;
    }
}
